<?php

$old_image = "{$_SERVER["DOCUMENT_ROOT"]}/{$_REQUEST["old_image"]}";
$new_image = "{$_SERVER["DOCUMENT_ROOT"]}/{$_REQUEST["new_image"]}";

if ($old_image != $new_image) {
    if (!copy($new_image, $old_image)) echo "failed to update image";
    else echo "success";
} else {
    echo "Images are the same";
}
?>

